#!/usr/bin/perl

use strict;
use warnings;

use lib '../../perllib', '../perllib', 'perllib', `fvwm-perllib dir`;
use FVWM::Commands;

my $mode = shift;  # -t|--text-only -x|--x-dialog

my $title = "Commands of fvwm-$FVWM::Commands::VERS";
my $commands_text = join('', map {
	sprintf " %-21s - %s\n", $_->{name}, $_->{descr}
} @FVWM::Commands::LIST);

if ($mode =~ /-t/) {
	print "$title:\n\n$commands_text";
	exit;
}

if ($mode =~ /-x/) {
	require FVWM::Module::Toolkit;
	FVWM::Module::Toolkit->show_message($commands_text, $title, 1);
	exit;
}
